package com.travel.recommend.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.travel.recommend.entity.RecommendParameterEntity;
import com.travel.recommend.service.RecommendParameterService;
import com.travel.common.utils.PageUtils;
import com.travel.common.utils.R;



/**
 * 
 *
 * @author lxw
 * @email lxw@gmail.com
 * @date 2024-01-23 09:52:06
 */
@RestController
@RequestMapping("recommend/recommendparameter")
public class RecommendParameterController {
    @Autowired
    private RecommendParameterService recommendParameterService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("recommend:recommendparameter:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = recommendParameterService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{recommendParameterId}")
    //@RequiresPermissions("recommend:recommendparameter:info")
    public R info(@PathVariable("recommendParameterId") Integer recommendParameterId){
		RecommendParameterEntity recommendParameter = recommendParameterService.getById(recommendParameterId);

        return R.ok().put("recommendParameter", recommendParameter);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("recommend:recommendparameter:save")
    public R save(@RequestBody RecommendParameterEntity recommendParameter){
		recommendParameterService.save(recommendParameter);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("recommend:recommendparameter:update")
    public R update(@RequestBody RecommendParameterEntity recommendParameter){
		recommendParameterService.updateById(recommendParameter);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("recommend:recommendparameter:delete")
    public R delete(@RequestBody Integer[] recommendParameterIds){
		recommendParameterService.removeByIds(Arrays.asList(recommendParameterIds));

        return R.ok();
    }

}
